# 定义IO标准
set_property IOSTANDARD LVCMOS33 [get_ports {counter[7]}]
set_property IOSTANDARD LVCMOS33 [get_ports {counter[6]}]
set_property IOSTANDARD LVCMOS33 [get_ports {counter[5]}]
set_property IOSTANDARD LVCMOS33 [get_ports {counter[4]}]
set_property IOSTANDARD LVCMOS33 [get_ports {counter[3]}]
set_property IOSTANDARD LVCMOS33 [get_ports {counter[2]}]
set_property IOSTANDARD LVCMOS33 [get_ports {counter[1]}]
set_property IOSTANDARD LVCMOS33 [get_ports {counter[0]}]
set_property IOSTANDARD LVCMOS33 [get_ports button]
set_property IOSTANDARD LVCMOS33 [get_ports reset]

# 设置IO引脚位置
set_property PACKAGE_PIN C2 [get_ports button]
set_property PACKAGE_PIN F4 [get_ports reset]
set_property PACKAGE_PIN AA21 [get_ports {counter[0]}]
set_property PACKAGE_PIN AA20 [get_ports {counter[1]}]
set_property PACKAGE_PIN W22 [get_ports {counter[2]}]
set_property PACKAGE_PIN W21 [get_ports {counter[3]}]
set_property PACKAGE_PIN T20 [get_ports {counter[4]}]
set_property PACKAGE_PIN R19 [get_ports {counter[5]}]
set_property PACKAGE_PIN P19 [get_ports {counter[6]}]
set_property PACKAGE_PIN U21 [get_ports {counter[7]}]

# 强制按钮和BUFG在同一半区
set_property LOC "IOB_X1Y146" [get_cells button_IBUF_inst] # 你可以修改为合适的区域
set_property LOC "BUFGCTRL_X0Y31" [get_cells button_IBUF_BUFG_inst] # 你可以修改为合适的区域

# 如果你想忽略时钟约束警告（不推荐，除非确定无影响）
set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets button_IBUF]

set_property IOSTANDARD LVCMOS33 [get_ports {count[7]}]
set_property IOSTANDARD LVCMOS33 [get_ports {count[6]}]
set_property IOSTANDARD LVCMOS33 [get_ports {count[5]}]
set_property IOSTANDARD LVCMOS33 [get_ports {count[4]}]
set_property IOSTANDARD LVCMOS33 [get_ports {count[3]}]
set_property IOSTANDARD LVCMOS33 [get_ports {count[2]}]
set_property IOSTANDARD LVCMOS33 [get_ports {count[1]}]
set_property IOSTANDARD LVCMOS33 [get_ports {count[0]}]
set_property IOSTANDARD LVCMOS33 [get_ports clk]
set_property IOSTANDARD LVCMOS33 [get_ports rst_n]
set_property PACKAGE_PIN H4 [get_ports clk]
set_property PACKAGE_PIN F4 [get_ports rst_n]
set_property PACKAGE_PIN AA21 [get_ports {count[0]}]
set_property PACKAGE_PIN AA20 [get_ports {count[1]}]
set_property PACKAGE_PIN W22 [get_ports {count[2]}]
set_property PACKAGE_PIN W21 [get_ports {count[3]}]
set_property PACKAGE_PIN T20 [get_ports {count[4]}]
set_property PACKAGE_PIN R19 [get_ports {count[5]}]
set_property PACKAGE_PIN P19 [get_ports {count[6]}]
set_property PACKAGE_PIN U21 [get_ports {count[7]}]
